package com.nw.serviceImpl;

import com.nw.dao.AddressDao;
import com.nw.entity.Address;
import com.nw.service.AddressService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.UUID;

@Service
@Transactional
public class AddressServiceImpl implements AddressService {
    @Resource
    AddressDao addressDao;
    @Override
    public HashMap<String, Object> insertOrderAddress(Address address) {
        HashMap<String, Object> map = new HashMap<>();
        try {
            address.setAddressId(UUID.randomUUID().toString());
            addressDao.insertOrderAddress(address);
            map.put("code","0");
            map.put("msg","地址添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            map.put("code","1");
            map.put("msg","地址添加失败");
        }
        return map;
    }
}
